.\"   $Id: filepath.3,v 1.1 2002/03/08 13:51:02 fred Exp $
.\" @(#)filepath.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot
.if t \{\
.so man1/alc_contents.mac
.XS \n%
.ti 0.2i
filepath
.XE
.XS4 \n%
.ti 0.2i
filepath
.XE4 \}
.TH FILEPATH 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY FUNCTIONS"
.SH NAME
filepath \- return the whole search path of a file
.so man1/alc_origin.1
.SH SYNOPSIS
.nf
.if n \{\
.ft B \}
.if t \{\
.ft CR \}
#include "mut.h"
char \(**filepath(name, extension)
char \(**name, \(**extension;
.ft R
.fi
.SH PARAMETERS
.TP 20
\fIname\fP
Name of the file to be search for
.TP
\fIextension\fP
File extension
.SH DESCRIPTION
\fBfilepath\fP return the absolute path of a cell.
This is useful for error messages, since the caller of mbk file functions
is not able to specify explicitly which file it opened.
Having such an information is also necessary when last modification times or
access times are needed, as for consistency checks.
The file is searched through the environment variable \fBMBK_WORK_LIB\fP(1),
and if not found, through \fBMBK_CATA_LIB\fP(1) in the user defined order.
.br
The file to be searched is called \fIname.extension\fP, if extension is not
\fBNULL\fP, else it is \fIname\fP. If \fIextension\fP is the empty string,
\fB""\fP, then the file name will be \fIname.\fP\ .
.br
.SH RETURN VALUE
\fBfilepath\fP returns \fBNULL\fP on failure, ie the file is not in the paths,
or the absolute path on success.
The value returned, when not \fBNULL\fP, is stored in a \fBstatic\fP buffer,
so this values is to use at return time or copied into a user buffer.
.SH EXAMPLE
.ta 3n 6n 9n 12n 15n 18n 21n
.nf
.if n \{\
.ft B \}
.if t \{\
.ft CR \}
#include <stdio.h>
#include "mut.h"
#include "mph.h"
void vti_error(fig, error)
phfig_list \(**fig;
char *(*error)();
{
		fprintf(stderr, "Syntax error in %s\\n", filepath(fig->NAME, "cp"));
		fprintf(stderr, "%s\\n", error());
}
.ft R
.fi
.SH SEE ALSO
.BR mbk (1),
.BR MBK_WORK_LIB (1),
.BR MBK_CATA_LIB (1),
.BR mbkfopen (3).
.BR mbkunlink (3).


.so man1/alc_bug_report.1

